package diseaseandcureadministration;

import diseaseandcureadministration.cure.Cure;

public class Clinic 
{
	public Clinic()
	{
		
	}
	
	public Patient enterClinic(Patient patient) throws PatientDiedException
	{
		Patient hospitalizedPatient = patient;
		
		Cure cure = Doctor.diagnose(hospitalizedPatient);
		
		if(cure != null)
		{			
			while(hospitalizedPatient.getHealth() < 100)
			{
				cure.administer(hospitalizedPatient);
			}			
		}
		else if (hospitalizedPatient.getSymptoms().size() != 0)
		{
			throw new PatientDiedException("We were unable to cure the patient");			
		}
		
		return hospitalizedPatient;
	}
}
